
// 目的： 将所有的ajax请求整合到一个文件中 -> 对接口统一管理

// 所有的ajax都是基于request()方法封装的 -> 不同的方法名 对应不同的功能 -> 请求方式,请求地址 已经和接口文档对应 

import "./axios.min.js";

// let baseURI = "http://192.168.51.77";  // 局域网测试接口地址
// let baseURI = "http://43.138.81.225";  // 真实服务器地址
// let baseURI = "http://43.138.81.140";  // 镜像服务器地址

// let baseURL = "http://43.138.81.225";  // 真实服务器地址

let baseURL = "";
let AUTH_TOKEN = localStorage.getItem("token");


// 全局默认配置 
axios.defaults.baseURL = baseURL;
// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

export const isExistUser = params => axios.get("/users/judgeUser", { params: params });
export const isExistPhone = params => axios.get("/users/judgePhone", { params });
export const isExistEmail = params => axios.get("/users/judgeEmail", { params });
export const register = params => axios.post("/users/add", params);

export const login = params => axios.post("/users/login", params);
export const loginAccount = params => axios.post("/users/loginAccount", params);
export const findInfo = params => axios.post("/users/findInfo", params);
export const updateUser = params => axios.post("/users/updateUser", params);

export const searchGoodsOrderLimit = params => axios.get("/demo/php/searchGoodsOrderLimit.php", { params });
export const addToShoppingCar = params => axios.post("/demo/php/addToShoppingCar.php", params);

